﻿@model IEnumerable<GdHotel.Data.SideBlockCustomPage>

<h2>Связи</h2>

<p>
    @Html.ActionLink("Создать", "Create", "ManageSideBlocksCustomPages", new { sideBlockId = ViewBag.SideBlockId }, new {})
</p>
@if (Model.Count() > 0)
{
    var first = Model.FirstOrDefault();
    <table>
        <tr>
            <th>
                @Html.LabelFor(m => first.SideBlock)
            </th>
            <th>
                @Html.LabelFor(m => first.CustomPage)
            </th>
            <th>
                @Html.LabelFor(m => first.Key)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.SideBlock.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CustomPage.Key)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Key)
                </td>
                <td>
                    @Html.ActionLink("Редактировать", "Edit", "ManageSideBlocksCustomPages", new { id = item.Id, ViewBag.sideBlockId }, new { }) |
                    @Html.ActionLink("Просмотр", "Details", "ManageSideBlocksCustomPages", new { id = item.Id, ViewBag.sideBlockId }, new { }) |
                    @Html.ActionLink("Удалить", "Delete", "ManageSideBlocksCustomPages", new { id = item.Id, ViewBag.sideBlockId }, new { })
                </td>
            </tr>
        }

    </table>
}